/**
 * Contains an application entity.
 */
package org.openfk.security.entity;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.validator.Length;
import org.hibernate.validator.NotEmpty;

import com.sun.istack.NotNull;

/**
 * Application entity.
 * @author Sławomir Czerwiński
 * @version 1
 */
@Entity
@Table(name = "applications")
public class Application implements Serializable {
	/**
	 * Serial version.
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * Application identifier.
	 */
	@Id @GeneratedValue @NotNull
	protected Integer id;

	/**
	 * Application roles.
	 */
	@OneToMany(mappedBy = "application")
	protected Set<Role> roles;

	/**
	 * Application name.
	 */
	@Length(max = 32,
			message = "")
	@NotEmpty
	protected String name;

}
